//
//	GXHotCar.m
//
//	Create by 曹 曹 on 11/8/2016
//	Copyright © 2016. All rights reserved.
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "GXHotCar.h"

NSString *const kGXHotCarMessage = @"message";
NSString *const kGXHotCarResult = @"result";
NSString *const kGXHotCarReturncode = @"returncode";

@interface GXHotCar ()
@end
@implementation GXHotCar




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
	if(![dictionary[kGXHotCarMessage] isKindOfClass:[NSNull class]]){
		self.message = dictionary[kGXHotCarMessage];
	}	
	if(![dictionary[kGXHotCarResult] isKindOfClass:[NSNull class]]){
		self.result = [[GXResult alloc] initWithDictionary:dictionary[kGXHotCarResult]];
	}

	if(![dictionary[kGXHotCarReturncode] isKindOfClass:[NSNull class]]){
		self.returncode = [dictionary[kGXHotCarReturncode] integerValue];
	}

	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
	if(self.message != nil){
		dictionary[kGXHotCarMessage] = self.message;
	}
	if(self.result != nil){
		dictionary[kGXHotCarResult] = [self.result toDictionary];
	}
	dictionary[kGXHotCarReturncode] = @(self.returncode);
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.message != nil){
		[aCoder encodeObject:self.message forKey:kGXHotCarMessage];
	}
	if(self.result != nil){
		[aCoder encodeObject:self.result forKey:kGXHotCarResult];
	}
	[aCoder encodeObject:@(self.returncode) forKey:kGXHotCarReturncode];
}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.message = [aDecoder decodeObjectForKey:kGXHotCarMessage];
	self.result = [aDecoder decodeObjectForKey:kGXHotCarResult];
	self.returncode = [[aDecoder decodeObjectForKey:kGXHotCarReturncode] integerValue];
	return self;

}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	GXHotCar *copy = [GXHotCar new];

	copy.message = [self.message copyWithZone:zone];
	copy.result = [self.result copyWithZone:zone];
	copy.returncode = self.returncode;

	return copy;
}
@end